import React,{ Component , Fragment} from 'react';
import {NavLink} from 'react-router-dom'
import '../../assets/iconfont/font_zorvdvo19w/iconfont.css'
import axios from 'axios'
export default class SearchBar extends Component{
    constructor(props){
        super(props);
        this.state={
            goodsName:'',
            fruitsItem:[]
        }
    }

    getGoodsName=(e)=>{
        this.setState({
            goodsName:e.target.value
        })
    }

    render(){
        let path={
            pathname:'/subgoodslist',
            query:this.state.goodsName
        }
        return(
            <Fragment>
                <div className='search-container'>
                    <div className='search-left'>
                        <span className='iconfont icon-sousuo'></span>
                        <input type='text' placeholder='请输入商品名称' onBlur={this.getGoodsName}/>
                    </div>
                    <NavLink to={path}><button onClick={this.searchGoods}>搜索</button></NavLink>
                </div>
            </Fragment>
        )
    }
}